<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=密匙"></script>
    <title>毕设--追踪系统</title>
    <style>
		.BMap_cpyCtrl {
            display: none;
        }
 
        .anchorBL {
            display: none;
        }
        html, body, #allmap{
            width: 100%;
            height: 100%;
            padding: 0;
            margin: 0;
            overflow: hidden;
        }
        #result{
            padding: 7px 10px;
            position: fixed;
            top: 10px;
            left: 20px;
            width: 450px;
            box-shadow: 0 2px 6px 0 rgba(27, 142, 236, 0.5);
            border-radius: 7px;
            z-index: 99;
        }

    </style>
</head>
<body>
    <div id='allmap'></div>
    <div id='result'>
        经度: <input id="lng"  type="text" value="111.69738505387114"/>
        纬度: <input id="lat" type="text" value="40.8189480584327"/>
		<button onclick="theLocation()"/>查询</button>(默认电院位置)
    </div>
    <script>
        // 百度地图API功能
        var map = new BMapGL.Map("allmap");
        map.centerAndZoom(new BMapGL.Point(116.331398,39.897445),11);
        map.enableScrollWheelZoom(true);
        var scaleCtrl = new BMapGL.ScaleControl();  // 添加比例尺控件
		map.addControl(scaleCtrl);
		var zoomCtrl = new BMapGL.ZoomControl();  // 添加缩放控件
		map.addControl(zoomCtrl);
        // 用经纬度设置地图中心点
        function theLocation(){
            if(document.getElementById("lng").value != "" && document.getElementById("lat").value != ""){
                map.clearOverlays(); 
                var new_point = new BMapGL.Point(document.getElementById("lng").value,document.getElementById("lat").value);
                var marker = new BMapGL.Marker(new_point);  // 创建标注
                map.addOverlay(marker);              // 将标注添加到地图中
                map.flyTo(new_point,18);      
            }
        }      
    </script>
</body>
</html>